export function card(): void {
  console.log('card~~');
  // that.loadComponent('text-dark');
  const index = this.quill.getSelection().index;
  console.log('index:', index);
  this.quill.insertEmbed(index, 'card', {
    url: 'devui.design',
    img: 'assets/devui-logo.png',
    title: 'DevUI Design of Angular',
  });
}

export function divider(): void {
  console.log('divider~~');
  const index = this.quill.getSelection().index;
  console.log('index:', index);
  this.quill.insertEmbed(index, 'divider', {
    url: 'assets/images/divider1.png',
    width: '660px',
  });
  // this.quill.insertEmbed(index, 'divider', {
  //   url: 'assets/images/divider2.png',
  //   width: '214px',
  // });
  // this.quill.insertEmbed(index, 'divider', {
  //   url: 'assets/images/divider3.png',
  //   width: '62px',
  // });
}

export function emoji(): void {
  console.log('插入表情');
  const index = this.quill.getSelection().index;
  this.quill.insertEmbed(index, 'emoji', {
    url: 'assets/emoji/good.png',
    width: '64px',
  });
}

export function file(): void {
  console.log('file~~');
  const index = this.quill.getSelection().index;
  console.log('index:', index);
  this.quill.insertEmbed(index, 'file', {
    url: 'assets/attachment/DevUI快速入门指南.pptx',
    name: 'DevUI快速入门指南.pptx',
    size: '(9 MB)',
  });
}

export function tag(value): void {
  console.log('tag~~', value);
  const range = this.quill.getSelection(true); // 获取光标位置
  // if (value) {
  this.quill.format('tag', {
    background: '#d4eefc',
    color: '#003a8c',
  });
  // this.quill.setSelection(range.index + 5, Quill.sources.SILENT); // 光标移到插入的文字后，并且让按钮失效
  // }
}

export function dragon(value): void {
  console.log('dragon~~');
  const index = this.quill.getSelection().index;
  this.quill.insertEmbed(index, 'dragon', {
    id: 'canvas-dragon',
  });
}

export function snake(value): void {
  const index = this.quill.getSelection().index;
  this.quill.insertEmbed(index, 'snake', {
    id: 'canvas-snake',
  });
}

export function pie(value): void {
  const index = this.quill.getSelection().index;
  this.quill.insertEmbed(index, 'pie', {
    width: '600px',
    height: '400px',
  });
}

export function mind(value): void {
  const index = this.quill.getSelection().index;
  this.quill.insertEmbed(index, 'mind', {
    width: '760px',
    height: '500px',
  });
}

export function pdf(value): void {
  const index = this.quill.getSelection().index;
  this.quill.insertEmbed(index, 'pdf', {
    width: '760px',
    height: '500px',
  });
}
